//
//  ApiSeriverProtocol.h
//  QFBAPP
//
//  Created by 无常先生 on 2018/5/2.
//  Copyright © 2018年 YIXun. All rights reserved.
//

#import <ReactiveObjC/ReactiveObjC.h>
#import <Foundation/Foundation.h>

typedef NS_ENUM(NSInteger, NetworkStatus) {
    NetworkStatusUnknown  = -1,
    NetworkStatusNotReachable = 0 ,
    NetworkStatusReachableViaWWAN = 1 ,
    NetworkStatusReachableViaWiFi = 2,
};

typedef NS_ENUM(NSUInteger, ApiServerType) {
    ApiServerTypeNone,
    ApiServerTypeAlpha,
    ApiServerTypeBeta,
    ApiServerTypeProduce,
};

@protocol ApiSeriverProtocol <NSObject>

/**
 *  @brief  当前API域名
 */
@property (nullable, nonatomic, copy, readonly) NSString *serverUrl;

/**
 *  @brief 当前服务器指向类型
 */
@property (nonatomic, assign) ApiServerType serverType;

/**
 *  @brief 设置每个api server type对应的api server url
 */
- (void)setServerUrl:(NSString *)serverUrl forServerType:(ApiServerType)serverType;

/**
 *  @brief  网络状态
 */
@property (nonatomic, assign, readonly) NetworkStatus networkStatus;

/**
 *  @brief  网络状态代号
 */
@property (nonatomic, strong, readonly) NSNumber *networkType;
/**
 *  @brief  是否接入网络
 */
@property (nonatomic, assign, readonly, getter=isReachable) BOOL reachable;

/**
 *  @brief  是否接入数据网络
 */
@property (nonatomic, assign, readonly, getter=isReachableViaWWAN) BOOL reachableViaWWAN;

/**
 *  @brief  是否接入无线网络
 */
@property (nonatomic, assign, readonly, getter=isReachableViaWiFi) BOOL reachableViaWiFi;

/**
 *  @brief 网络状态的信号，订阅此信号
 */
@property (nonatomic, strong, readonly) RACSignal *networkStatusSignal;

/**
 *  @brief  开始侦听服务器网络链接状态
 */
- (void)startMonitoring;

/**
 *  @brief  停止侦听服务器网络链接状态
 */
- (void)stopMonitoring;

@end
